package pers.lance.exam.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pers.lance.exam.dao.ItemDao;
import pers.lance.exam.pojo.Base;
import pers.lance.exam.pojo.Item;
import pers.lance.exam.service.ItemService;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @ Author     ：LILA3
 * @ Date       ：Created in 2:09 PM 7/31/2018
 */
@Service
public class ItemServiceImpl implements ItemService {
    @Autowired
    ItemDao itemDao;

    @Transactional
    public Item addItem(Item item) {
        return itemDao.add(item);
    }

    @Transactional
    public Item deleteItem(Item item) {
        return itemDao.delete(item);
    }

    public Item getItemById(Item item) {
        return itemDao.findById(item);
    }

    public List<Item> listItem() {
        return itemDao.findAll();
    }

    public List<Item> findByBase(Base base) {
        return itemDao.findByBase(base);
    }
}
